package cn.webrx.wxs.mapper;

import cn.webrx.wxs.entity.Goods;
import cn.webrx.wxs.vo.VoGoods;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

@Mapper
public interface GoodsMapper {
    int deleteByPrimaryKey(Integer id);

    int insert(Goods record);

    Goods selectByPrimaryKey(Integer id);

    List<Goods> selectAll();

    int updateByPrimaryKey(Goods record);

    @Select("select id,name from ws_goods limit #{st},#{si}")
    List<Map<String, Object>> query(@Param("st") int index, @Param("si") int size);


    @Select("select id,name from ws_goods")
    List<Map<String, Object>> page();

    @Select("select id,name,image,stock,is_new,is_best,is_like,create_time,sort,1 type from ws_goods where status = #{type}")
    List<VoGoods> lists(int type);


}